//
//  DetailViewController.m
//  iPadDev01
//
//  Created by smu on 11-7-30.
//  Copyright 2011年 duk. All rights reserved.
//

#import "DetailViewController.h"


@implementation DetailViewController
@synthesize label;
@synthesize toolbar;
@synthesize popoverController;

- (void)viewDidLoad
{
    [super viewDidLoad];
}

-(void)detail:(id)sender
{
    index = sender;
    self.label.text = [NSString stringWithFormat:@"Row %d,section %d",[index row],[index section]];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
	return YES;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload
{
    self.popoverController = nil;
    self.toolbar = nil;
    self.label = nil;
    [super viewDidUnload];
}

- (void)dealloc
{
    [self.toolbar release];
    [self.popoverController release];
    [self.label release];
    [super dealloc];
}


#pragma mark -
#pragma mark - Split view support
//主要是实现协议的相应方法。一个是横屏时，我们显示的界面和竖屏时显示的界面。
//竖屏
- (void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc
{
    barButtonItem.title = @"列表";
    NSMutableArray *items = [[toolbar items] mutableCopy];
    [items insertObject:barButtonItem atIndex:0];
    [toolbar setItems:items animated:YES];
    [items release];
    self.popoverController = pc;
}

//横屏
- (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
{
    NSMutableArray *itmes = [[toolbar items] mutableCopy];
    [itmes removeObjectAtIndex:0];
    [toolbar setItems:itmes animated:YES];
    [itmes release];
    self.popoverController = nil;
}



- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}









- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}




#pragma mark - View lifecycle






@end
